package com.example.ormsqlsplicingframe1.utlis;

import io.swagger.annotations.ApiModel;
import lombok.SneakyThrows;

import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.util.Date;

@ApiModel("获取时间")
public class GetDate {

    private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


    public static String date(){
        return dateFormat.format(new Date());
    }


    public static String date(Date date){
        return dateFormat.format(date);
    }

    @SneakyThrows
    public static Date date(Object value){
        return dateFormat.parse(value.toString());
    }
}
